<script type="text/javascript" src="<?=base_url();?>java_scripts/vote_scripts.js"></script>

<?php 
	$top_name=(!isset($top_name))?"":$top_name;
	$desc=(!isset($top_desc))?"":$top_desc;
	$max=(!isset($max_item))?"":$max_item;
	$error_msg=(!isset($error))?"":$error;
?>
	<h3 class="capture">Vote Management</h3>
    <div id="wrap">
    
    <div id="tdd_selected">
    	<div class="dd_selected">Add New - Vote Topic</div>
        <div class="dd_view">

	      	<form action="" method="post">
	      		<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
	      			<tr><td colspan="2" height="15"> </td></tr>
	      			<tr align="center">
	      				<td height="" align="right">Topic Name :&nbsp;&nbsp;&nbsp;</td>
	      				<td align="left"><input type="text" value="<?=$top_name?>" name="txttopname" id="txttopname" maxlength="255" style="width: 350px;" /><div id='existing'><?=$error_msg?></div></td>
	      			</tr>
	      			<tr align="center">
	      				<td height="55" align="right">Category :&nbsp;&nbsp;&nbsp;</td>
	      				<td align="left">
	      					<select name="selcat" id="selcat" onchange="javascript:changeCategory('<?=site_url("vote_management/assignItemForm/".$id)?>')">
	      						<?php 
	      							foreach ($categories->result_array() as $category) {
	      								$selectMe=($cat_id==$category['vote_item_cat_id'])?"selected":"";
	      						?>
	      						<option <?=$selectMe?> value="<?=$category['vote_item_cat_id']?>"><?=$category['vote_item_cat_desc']?></option>
	      						<?php 
	      							}
	      						?>
	      					</select>
	      				</td>
	      			</tr>
	      			<tr align="center">
	      				<td height="55" align="right">Description :&nbsp;&nbsp;&nbsp;</td>
	      				<td align="left">
	      					<textarea rows="5" name="txttopdesc" id="txttopdesc" style="width: 350px;"><?=$desc?></textarea>
	      				</td>
	      			</tr>
	      			<tr align="center">
	      				<td height="55" align="right">Max Item :&nbsp;&nbsp;&nbsp;</td>
	      				<td align="left"><input type="text" value="<?=$max?>" name="txtmax" id="txtmax" maxlength="3" style="width: 350px;" /></td>
	      			</tr>
	      			<tr align="center">
	      				<td>&nbsp;</td>
	      				<td height="20" colspan="2" align="left"><br/><input type="button" class="button_back_end" onclick="javascript:window.location='<?=site_url("vote_management/voteTopic")?>'" style="cursor: pointer; width:50px;" value="Back"/>&nbsp;&nbsp;<input type="button" class="button_back_end" onclick="javascript:addTopic('<?=site_url("vote_management/addTopic")?>')" style="cursor: pointer; width:50px;" value="Add"/></td>
	      			</tr>
	      		</table>
	      	</form>
	</div>
</div>
</div>